import {
  Column,
  Entity,
  PrimaryGeneratedColumn,
  UpdateDateColumn,
} from 'typeorm';

@Entity()
export class GenerativeAIAchievement {
  @PrimaryGeneratedColumn('uuid')
  id: string;

  @Column()
  name: string;

  @Column()
  description: string;

  @Column('simple-array', { default: '' })
  tags: string[]; //数据库存储空值时，tags 默认为 []

  @Column()
  model: string;

  @Column()
  prompt: string;

  @Column('enum', { enum: ['picture', 'video', 'audio'], default: 'picture' })
  type: string;

  // 下边是文件相关
  @Column({ default: '' })
  file_name: string;

  @Column({ default: '' })
  original_name: string;

  @Column({ default: '' })
  src: string;

  @Column({ default: '' })
  folder: string;

  @Column({ default: '' })
  raw_type: string;

  @Column({ default: '' })
  size: string;

  @Column({
    type: 'timestamp without time zone',
    default: () => 'CURRENT_TIMESTAMP',
  })
  create_time: Date;

  @UpdateDateColumn({
    name: 'update_time',
    type: 'timestamp',
    default: () => 'CURRENT_TIMESTAMP',
  })
  update_time: Date;

  @Column({ default: '' })
  uploader: string;
}
